package com.mccrea.pattern.state;

/**
 * @Classname MiddleState
 * @Description 中等
 * @Date 2021/5/24 0024 15:07
 * @Created by Mccrea_Gao
 */
public class MiddleState extends AbstractState {

    public MiddleState(AbstractState state) {
        scoreContext = state.scoreContext;
        stateName = "中等";
        score = state.score;
    }

    @Override
    public void checkState() {
        if (score < 60) {
            scoreContext.setState(new LowState(this));
        } else if (score >= 90){
            scoreContext.setState(new HighState(this));
        }
    }
}
